<?php
declare (strict_types = 1);

namespace app\index\controller;

use app\common\controller\ServerResponse;
use think\Request;

class Login extends ServerResponse
{
    //登录
    public function falseLogin(Request $request){
        $account = $request->post('account')??1;
        $password = $request->post('password')??1;
        $name = "muge";
        $hash = hash_hmac("sha512",$name.mt_rand().time(),$account.$password.mt_rand(),false);
//        dump(str_replace('=','',base64_encode($hash)));
        $token = str_replace('=','',base64_encode($hash));
        $c = "admin-token";
        return ['code'=>1,'data'=>$c];
//        return ServerResponse::jsonData(1,'请求成功',$token);
    }
    //获取用户信息
    public function falseInfo(){
        $data = "muge";
        return ['code'=>1,'data'=>$data];
    }
}
